<template>
	<view class="content">
		<view class="block list-block">
			<template v-if="list.length>0">
				<view
					@click="navigate('/page_other/job_hunting/job_detail/index?id='+item.jobPublish.id+'&jobType='+item.jobType)"
					class="list-item" v-for="(item,index) in list" :key="item.id">
					<view class="list-info">
						<view class="title">{{item.jobPublish.jobTitle}}</view>
						<view class="address">{{item.jobPublish.jobAddress}}</view>
						<view class="label-block">
							<view class="label-item" v-for="label in item.label">{{label}}</view>
						</view>
						<view class="wage" v-if="item.jobPublish.minSalary">{{item.jobPublish.minSalary}}-{{item.jobPublish.maxSalary}}<text
								class="unit">元</text></view>
							<view class="wage" v-else>面议</view>	
					</view>
					<view class="detail-info">
						<view class="name">{{item.comRecruiters.comPosition}}</view>
						<image mode="aspectFill" :src="item.jobPublish.comRecruiters.user.faceUrl" class="photo">
						</image>
					</view>
				</view>
			</template>
			<view v-else-if="list.length>0&&!more" style="text-align: center;">没有更多了哦</view>
			<view v-else style="text-align: center;">暂无数据</view>
		</view>
	</view>
</template>

<script>
	import {
		getLookMeFindByCidList
	} from '@/api/count_details.js';
	import {
		getStorage
	} from '@/util/auth.js';
	import {
		isMore
	} from '@/util/util.js'
	import util from '@/util/util.js';
	export default {
		data() {
			return {
				imageUrl: '',
				list: [],
				page: 1,
				limit: 10,
				more: true,
				total: 0,
			}
		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url
				})
			},
			refresh() {
				this.page = 1
				this.more = true
				this.getList(true);
			},
			async getList(refresh = false) {
				if (this.more) {
					let config = {
						userType: 1,
						lookMeType: 3,
						page: this.page,
						limit: this.limit
					}
					uni.showLoading({
						title: '加载中',
						mask: true
					})
					let res = await getLookMeFindByCidList(config)
					let list = res.list ?? [];
					this.list = refresh ? list : [...this.list, ...list],
						this.total = res.count
					this.more = isMore(this.page, this.limit, this.total)
				}
			}
		},
		onLoad(e) {
			this.imageUrl = this.globalConfig.imageUrl;
			this.getList(true);
		},
		onPullDownRefresh() {
			this.refresh();
			uni.stopPullDownRefresh();
		},
		onReachBottom() {
			if (this.more) {
				this.page++;
				this.getList()
			}
		},
	}
</script>

<style lang="scss">
	$box-shadow: 0 0 10px 0 #efefef;

	page {
		background: #FEFEFE;
	}

	.content {
		width: 100%;

		.loadingicon {
			width: 100%;
			height: 80rpx;
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			justify-content: center;
		}

		.loading {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			align-items: center;
			justify-content: center;
			position: relative;
			text-align: center;
		}

		.loading .line {
			position: absolute;
			width: 450rpx;
			left: 150rpx;
			top: 50rpx;
			height: 1px;
			border-top: 1px solid #eee;
		}

		.loading .text {
			position: relative;
			display: inline-block;
			padding: 0 20rpx;
			background: #fff;
			z-index: 2;
			color: #777;
		}

		.loadingicon .loading {
			animation: load linear 1s infinite;
			font-size: 45rpx;
			color: #000;
		}

		.loadingicon {
			width: 100%;
			height: 80rpx;
		}

		.bg-img {
			width: 100%;
			position: absolute;
			top: 0;
		}

		.block {
			width: 100%;
			margin-bottom: 40rpx;
			//box-shadow: $box-shadow;
			position: relative;
			padding: 40rpx;

			.search {
				width: 100%;
				height: 70rpx;
				padding: 0 20rpx;
				font-size: 28rpx;
				//background: #F3F3F3;
				border-radius: 50rpx;
				border: 1px solid #F4F5F7;

				.inputPlaceholder {
					color: #F4F5F7;
				}
			}

			.iconfont.icon-sousuo {
				position: absolute;
				transform: translate(0, -50%);
				right: 20rpx;
				top: 50%;
				font-size: 38rpx;
				font-weight: bold;
				color: #F4F5F7;
			}

			.resume-builder {
				width: 100%;
				height: 260rpx;
				border-radius: 20rpx;
			}

			.enterprise-item {
				display: flex;
				flex-direction: row;

				.photo {
					width: 160rpx;
					height: 160rpx;
					border-radius: 10rpx;
					margin-right: 20rpx;
					flex-grow: 0;
				}

				.info {
					position: relative;
					flex-grow: 1;

					.other,
					.jobs {
						margin-top: 20rpx;
					}

					.num {
						color: #FE7526;
					}

					.postion {
						position: absolute;
						bottom: 12rpx;
						right: 0;

						.iconfont {
							margin-right: 10rpx;
						}
					}
				}
			}
		}

		.block.swiper-block {
			height: 300rpx;
			border-radius: 20rpx;
			box-shadow: none;
		}

		.block.menu-block {
			margin-top: 350rpx;
			border-radius: 20rpx;
			//background: #fff;
			//height: 200rpx;
			display: flex;
			flex-direction: row;
			justify-content: center;

			.menu-item {
				width: calc(100%/3 - 20rpx);
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-right: 30rpx;
				//justify-content: center;

				.menu-icon {
					width: 100%;
					//width: 100rpx;
					//height: 100rpx;
				}

				.menu-name {
					font-size: 28rpx;
					margin-top: 20rpx;
				}
			}

			.menu-item:nth-child(3n) {
				margin-right: 0;
			}
		}

		.block.tab-block {
			box-shadow: none;
			display: flex;
			flex-direction: row;
			justify-content: left;
			flex-wrap: wrap;
			margin-bottom: 20rpx;

			.tab-item {
				padding: 10rpx 15rpx;
				font-weight: bold;
				font-size: 30rpx;
				margin-right: 30rpx;
			}

			.tab-item.active {
				background: url("https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/job_hunting/home/tab_selected_bg.png") no-repeat right bottom;
				background-size: 70%;
				font-size: 32rpx;
			}
		}

		.block.list-block {
			box-shadow: none;
			display: flex;
			flex-direction: column;
			margin-bottom: 0;

			.list-item {
				width: 100%;
				background: #fff;
				border-radius: 10rpx;
				box-shadow: $box-shadow;
				padding: 20rpx;
				display: flex;
				flex-direction: row;
				justify-content: center;
				margin-bottom: 20rpx;

				.detail-info {
					width: 260rpx;
					height: 200rpx;
					display: flex;
					flex-direction: row;
					flex-wrap: wrap;
					justify-content: center;
					align-items: center;

					.name {
						width: 110rpx;
						font-size: 24rpx;
						color: #999;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						text-align: center;
						text-indent: 15rpx;
					}

					.photo {
						width: 70rpx;
						height: 70rpx;
						border-radius: 100%;
						background: #efefef;
					}

					.apply-btn {
						border: 1px solid #FE7526;
						border-radius: 8rpx;
						color: #FE7526;
						font-size: 24rpx;
						padding: 8rpx 28rpx;
						position: relative;
						left: 30rpx;
					}
				}

				.list-info {
					width: calc(100% - 180rpx);
					display: flex;
					flex-direction: column;

					>view {
						width: 100%;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.title {
						color: #000;
						font-weight: bold;
						font-size: 34rpx;
						width: 360rpx;
					}

					.address {
						color: #999;
						font-size: 26rpx;
						margin-top: 20rpx;
					}

					.label-block {
						font-size: 24rpx;
						display: flex;
						flex-direction: row;
						flex-wrap: wrap;
						justify-content: left;
						margin-top: 20rpx;

						.label-item {
							padding: 8rpx 20rpx;
							background: #F5F6F8;
							color: #999;
							margin: 0 10rpx 20rpx 0;
						}
					}

					.wage {
						color: #FE7526;
						font-size: 36rpx;
						font-weight: bold;

						.unit {
							font-size: 28rpx;
							font-weight: normal;
						}
					}
				}
			}

			.person-item {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				padding: 0 30rpx;
				margin-bottom: 30rpx;

				.info-block,
				.job-block {
					width: 100%;
					padding: 20rpx 0;
				}

				.info-block {
					border-bottom: 1px solid #efefef;
					display: flex;
					flex-direction: row;
					align-items: center;

					.user-photo {
						width: 100rpx;
						height: 100rpx;
						border-radius: 50%;
					}

					.info {
						width: calc(100% - 120rpx);
						margin-left: 20rpx;

						.name {
							font-weight: bold;
							font-size: 34rpx;
						}

						.others {
							display: flex;
							flex-direction: row;

							.other-item {
								font-size: 26rpx;
								color: #999;
								margin-top: 14rpx;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							}
						}

					}
				}

				.job-block {
					display: flex;
					flex-direction: row;
					align-items: center;

					.job {
						width: calc(100% - 140rpx);
						display: flex;
						flex-direction: column;
						justify-content: center;

						.label-block {
							width: 100%;
							display: flex;
							flex-direction: row;
							flex-wrap: wrap;

							.label-item {
								background: #F4F5F7;
								color: #999;
								font-size: 24rpx;
								padding: 4rpx 10rpx;
								margin-right: 20rpx;
								margin-bottom: 20rpx;
							}
						}

						.job-content {
							width: 100%;
							font-size: 26rpx;
						}
					}

					.btn-block {
						width: 140rpx;
						display: flex;
						align-items: center;
						justify-content: center;

						.btn {
							padding: 6rpx 26rpx;
							border: 1px solid #FE7526;
							border-radius: 6rpx;
							color: #FE7526;
							font-size: 24rpx;
						}
					}
				}
			}

			.person-item:last-child {
				margin-bottom: 0;
			}
		}
	}
</style>
